//
//  DDContactRequestCell.m
//  DingDongZP
//
//  Created by Ray on 16/4/26.
//  Copyright © 2016年 iyhjiang.com. All rights reserved.
//

#import "DDContactRequestCell.h"

@interface DDContactRequestCell ()
@property (nonatomic, strong) UILabel *contentLab;
@end

@implementation DDContactRequestCell

- (instancetype)initWithFrame:(CGRect)frame
{
    if (self = [super initWithFrame:frame])
    {
        self.contentLab = [[UILabel alloc] initWithFrame:CGRectZero];
        self.contentLab.backgroundColor = [UIColor colorWithWhite:.8 alpha:0.5];
        self.contentLab.layer.cornerRadius = 4.0;
        self.contentLab.layer.masksToBounds = YES;
        self.contentLab.textAlignment = NSTextAlignmentCenter;
        self.contentLab.textColor = COLOR_FONT_DARK_GRAY;
        self.contentLab.font = [UIFont systemFontOfSize:14.0];
        [self.contentView addSubview:self.contentLab];
    }
    return self;
}

- (void)setDataModel:(RCMessageModel *)model
{
    [super setDataModel:model];
    
    DDContactRequestMessage *message = (DDContactRequestMessage *)model.content;
    
    if (message.requestType == DDContactRequestPhone) {
        
        self.contentLab.text = @"请求电话已发送";
    } else {
        
        self.contentLab.text = @"请求微信已发送";
    }
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    self.contentLab.frame = CGRectMake(20, 0, 120, 20);
    self.contentLab.centerX = CGRectGetMidX(self.bounds);
    self.contentLab.center = CGPointMake(self.frame.size.width/2, self.frame.size.height/2);
    UIView *portrait = (UIView *)self.portraitImageView;
    portrait.hidden = YES;
    [self.messageTimeLabel removeFromSuperview];
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
